package com.ktwlsoft.archivemanage.controller;

import com.ktwlsoft.archivemanage.domain.business.businessService.GuidanceProfileService;
import com.ktwlsoft.archivemanage.payload.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.Year;

@Api(description = "指导得分分析")
@RestController
@RequestMapping("/guidanceProfile")
public class GuidanceProfileController {

    private final GuidanceProfileService service;

    public GuidanceProfileController(GuidanceProfileService service) {
        this.service = service;
    }

    @ApiOperation("年度考核指标失分排名")
    @GetMapping("/markLostRanking")
    public ResponseEntity<?> markLostRanking(@RequestParam Year year, @RequestParam String guidNum){
        return ResponseEntity.ok(Result.ok(service.markLostRanking(year, guidNum)));
    }

    @ApiOperation("立档单位得分排名")
    @GetMapping("/unitMarkRanking")
    public ResponseEntity<?> unitMarkRanking(@RequestParam Year year) {
        return  ResponseEntity.ok(Result.ok(service.unitMarkReanking(year)));
    }

    @ApiOperation("立档单位业务检查得分历年变化趋势")
    @GetMapping("/guidanceVariationOfYear")
    public ResponseEntity<?> guidanceVariationOfYear() {
        return ResponseEntity.ok(Result.ok(service.getGuidanceVariationOfYear()));
    }
}
